import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { MessageModule } from './message/message.module';

import { TypeOrmModule } from '@nestjs/typeorm';
import { Message } from './message/entities/message.entity'; // 导入实体
import { APP_INTERCEPTOR } from '@nestjs/core';
import { ResponseInterceptor } from './common/interceptors/response.interceptor';
@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: 'hm1001.mysql.polardb.rds.aliyuncs.com',
      port: 3306,
      username: 'mroot',
      password: 'hm13579@88',
      database: 'ascleway_device',
      entities: [Message, __dirname + '/**/*.entity{.ts,.js}'],
      synchronize: false,
    }),
    MessageModule,],
  controllers: [AppController],
  providers: [
    AppService,
    {
      provide: APP_INTERCEPTOR,
      useClass: ResponseInterceptor,
    },],

})
export class AppModule { }
